﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Rison.Web.Common;
using Rison.BusinessFacade.Common;
using Rison.BusinessFacade.Entity.XT;
using Rison.BusinessFacade.Facade.XT;
using Rison.BusinessFacade.Entity.Biz;
using Rison.BusinessFacade.Facade.Biz;
using Rison.BusinessFacade.Helper;

namespace Rison.Web.zxdc
{
    public partial class OnlineSuveryDetail : PageDataViewBase
    {
        protected void Page_Init(object sender, EventArgs e)
        {
           base.baseFacade = new DataSourceHelperFacade(InfoCategory.在线调查);
         }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["key"]))

            //Response.Write("<script type='text/javascript'>");
            {
                
                LoadInfo();
            }
           
        }
    


     private void LoadInfo()
        {
            string infoId = Request.QueryString["key"];
            
            //dataset data = (baseFacade as DataSourceHelperFacade).GetAllAnswerbyID();

            //InfosReaderFacade facade = new InfosReaderFacade("gg");

            //DataSet ds = facade.ReadVoteAnswer(infoId);
             //DataSourceHelperFacade baseFacade ;
            DataSet ds = (baseFacade as DataSourceHelperFacade).GetAllAnswerbyID(infoId);
                    

            Response.Write("<script type='text/javascript'>");
            //Response.Write("alert('aaa');");
            Response.Write("var data = [];");

            int i = 0;
           foreach (DataRow dr in ds.Tables[0].Rows)
            {
                
                Response.Write("data["+i+"] = ['" + dr["AnswerContent"] + " ', '" + dr["VoteCount"] + "'];");
                i = i + 1;
            }
            Response.Write("</script>");
            
        }

    }
}
